package com.zpark.controller;

import com.zpark.beans.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.ws.RequestWrapper;
/*
* 注解：@RestController它是@Controller+@ResponseBody 两个注解的结合
* 作用：返回json格式的数据
* */
@RestController
//@Controller
@RequestMapping("/config")
public class ConfigController {
    // 自动注入
    @Autowired
    private Person person;

    //使用values注解获取配置
    @Value("${server.port}")//spel表达式
    private String port;

    //声明当前方法返回json格式数据
    //@ResponseBody
    @RequestMapping("/person")
    public Person getPerson(){
        return person;
    }
@RequestMapping("/port")
    public String getPort(){
        return port;
    }


}
